﻿@using HiLand.General.Entity
@using GBFinance.Web.Controllers
@model LoanBasicEntity
@using HiLand.Utility4.MVC.Controls
@using GBFinance.Web.Control
@{
    Layout = null;

    MvcControlUsingModes usingMode = (this.ViewContext.Controller as GBFinance.Web.Controllers.SecuredController).GetUsingMode();
    bool isPopLayer = (this.ViewContext.Controller as GBFinance.Web.Controllers.SecuredController).CheckIsPopLayer(); 
}
<div id="UInitialLoanInformationContainer">
    @using (Html.BeginForm())
    {
        <fieldset id="securedDetails" class="simpleFieldset">
            <legend>Initial Loan Details</legend>
            @Html.HiTextArea().UsingMode(usingMode).Name("LoanPurpose").Value(Model.LoanPurpose).Lable("Purpose").Render()
            @Html.HiTextBox().UsingMode(usingMode).Name("LoanAmount").Value(Model.LoanAmount.ToString()).Lable("Amount Required").Render()
            @Html.GBFLoanTermCountDropDownList().UsingMode(usingMode).Name("LoanTermCount").Value(Model.LoanTermCount.ToString()).Lable("Loan Terms").Render()
            @Html.HiddenFor(m => m.LoanGuid)
        </fieldset>
    }
    @if (isPopLayer == true)
    {
        //GBFViewHelper.DisplaySubmitInfo("#UInitialLoanInformationContainer");
        <div class="notification attention png_bg">
            <a href="#" class="close">
                <img src="@Url.Content("~/Content/NotificationImages/cross_grey_small.png")" title="Close this notification" alt="close" /></a>
            <div class="notificationContent">
                You can close this PopWindow by the key "Esc".
            </div>
        </div>
        <input type="button" value="Save" id="btnSave" />
        <script type="text/javascript">
            $(document).ready(function () {
                $("#UInitialLoanInformationContainer #btnSave").click(function () {
                    $("#UInitialLoanInformationContainer form").ajaxSubmit({
                        success: function (responseInfo) {
                            if (responseInfo.IsSuccessful == false) {
                                alert(responseInfo.statusMessage);
                            }
                            else {
                                //alert(responseInfo.IsSuccessful);
                                window.location.reload();
                            }
                        },
                        data: { "isAjaxDeal": "true" }
                    });
                });
            });
        </script>
    }
</div>
